The next line is where the fun begins. the "\12" sends an ASCII 12, which is
more commonly know as a screen clear. This will clear your user's screen to
ensure proper menu positioning. If the system your user is using does not
recognize ASCII 12 as a screen clear, then this menu will look like a mess to
him. I'll explain later what to do if this happens. After the \12, comes two\13's. This again, sends two more RETURN's to the user. This just places the
menu two lines down from the top of the menu. \27[33m is the first color
sequence. This turns the character color to RED. Everything following will
show up on the callers screen as color. I said 33 is RED, but RED is not what
is always seen. The actual color seen will depend on what the user has his or
her colors set to in preferences. The SYSOP will see YELLOW in his menu. This
is due to the color definitions used in BBS-PC!. I haven't found a way to
change this.
The remainder of the menu is then sent in RED, until it comes to this line.
| \27[0m !: Turn Off ANSI |"
The \27[0m turns off ALL ANSI escape sequences which are now active. In other
words, the character color received by the caller will return to white, or
what ever color that user has set his or her white to in preferences. The
reason I did this in this line, is because my default menu uses the ANSI
sequences. A user who is calling with a terminal that can not accept ANSI
sequences will see a mess for a menu the first time through. The comand to
turn off the ANSI is then clearly visible.
As I am sure you have noticed, what we have actually done here, is display
the menu descriptions, but not the actual commands. A user sees a menu that
says SCAN MESSAGES E-MAIL PAGE SYSOP etc ..., but the user doesn't know what
key to press to activate that command. Here's where the real fun begins. The
following sequences cause the cursor to jump around the screen filling in the
actual commands. This can make for a real interesting menu.
Here's the sequences that actually do that.
title = "\27[0m \27[6;3H S: \27[6;23H E: \27[6;39H R:"
The first sequence (\27[0m) turns off all ANSI as it did before, this causes
the actual commands to pop onto the screen in a color different from the rest
of the menu. The next sequence \27[6;3H S: sends the cursor to row 6, column
3 and prints S: the command for Scan Messages. \27[6;23H E: sends the cursor
to row 6, column 23 and prints E:, then command for E-Mail.
As you can now see, we are filling in the menu. You should have little or no
trouble figuring out what the remainder of the sequences do. They all go to
a specified row and column and print a command.
title = "\27[3;21H \7 THE AMIGA PROJECT! "
This one sends the cursor to row 3, column 21 and sends an ASCII 7, better
known as CONTROL-G or a bell, followed by the name of my BBS, THE AMIGA
PROJECT!
That's it. That's all there is to it.
The way I have my BBS set up, when a user selects the ! command (Turn OFF
ANSI), it sends the user to another menu set which does not utilize the ANSI
escape sequences. I also have two menus set up for the AMIGA in my terminal
definitions. One is called AMIGA! and the other is called AMIGA! *ANSI*.
Obviously, one uses the ANSI escape sequences and the other does not. This
allows each user to decide for himself if he does or does not want the fancy
color and screen display.
There are a lot more ANSI sequences available. Get you hands on an ANSI table
and see what variations you can come up with for menu display. A few quick
examples of more ANSI sequences are:
ESC[nC where n = a number. The cursor is then moved right that
number of lines without changing rows.
ESC[nD where n = a number. The cursor is then moved left that
number of lines without changing rows.
ESC[K where K = the letter "K". Erases the curent line from the
cursor position to the end.
Most of the popular public domain terminal programs accept the ANSI escape
sequences. Some, such as OnLine!, allow the user to choose between several
terminal types, one of which is ANSI. The user MUST be set to ANSI or the
screen will be a mess on his end.
If you want to take a quick look at what this demonstration really looks
like, feel free to set your terminal to ANSI, and give my BBS a call. You can
reach us at 300/1200 baud, 24 hrs, (805) 834-9383.